package org.jingouzhui.test.domain;

import lombok.extern.slf4j.Slf4j;
import org.jingouzhui.domain.strategy.service.armory.IStrategyArmory;
import org.jingouzhui.domain.strategy.service.armory.IStrategyDispatch;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * @description: 策略装配测试
 * @author: jingouzhui
 * @date: 2025/4/24 16:04
 */
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class StrategyArmoryTest {

    @Resource
    private IStrategyArmory strategyArmory;
    @Resource
    private IStrategyDispatch strategyDispatch;

    @Before
    public  void test_strategyArmory(){
        strategyArmory.assembleLotteryStrategy(100006L);
    }

    /**
     * 策略概率装配
     */
    @Test
    public void test_getRandomAwardId(){
        log.info("测试结果，奖品ID值{}",strategyDispatch.getRandomAwardId(100006L));


    }

    /**
     * 策略权重概率装配
     */
    @Test
    public void test_getRandomAwardId_ruleWeightValue(){
        log.info("测试结果，奖品ID值{},策略4000",strategyDispatch.getRandomAwardId(100006L,"4000:102,103"));
        log.info("测试结果，奖品ID值{},策略5000",strategyDispatch.getRandomAwardId(100006L,"5000:104,105"));
        log.info("测试结果，奖品ID值{},策略6000",strategyDispatch.getRandomAwardId(100006L,"6000:106,107"));


    }
}
